
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>第一个docker版的java程序 · 猿者荣耀</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="字维嘉">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="漫谈云计算、虚拟化、容器化.html" />
    
    
    <link rel="prev" href="docker安装.html" />
    

    
        <link rel="shortcut icon" href='../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="bookmark" href='../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="apple-touch-icon" href='../source/images/apple-touch-icon.jpg'>
    
    
        
        <link rel="apple-touch-icon" sizes="120x120" href="../source/images/apple-touch-icon.jpg">
        
        <link rel="apple-touch-icon" sizes="180x180" href="../source/images/apple-touch-icon.jpg">
        
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://orororz.com" target="_blank" class="custom-link">字维嘉</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    首页介绍
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">java</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="readme.html">
            
                <a href="readme.html">
            
                    
                    容器技术
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="容器技术及其应用白皮书.html">
            
                <a href="容器技术及其应用白皮书.html">
            
                    
                    容器技术及其应用白皮书
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="docker安装.html">
            
                <a href="docker安装.html">
            
                    
                    docker安装
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.1.3" data-path="第一个docker版的java程序.html">
            
                <a href="第一个docker版的java程序.html">
            
                    
                    第一个docker版的java程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="漫谈云计算、虚拟化、容器化.html">
            
                <a href="漫谈云计算、虚拟化、容器化.html">
            
                    
                    漫谈云计算、虚拟化、容器化
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../springboot/readme.html">
            
                <a href="../springboot/readme.html">
            
                    
                    springboot
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../springboot/SpringBoot启动结构图.html">
            
                <a href="../springboot/SpringBoot启动结构图.html">
            
                    
                    SpringBoot启动结构图
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="../microservices/readme.html">
            
                <a href="../microservices/readme.html">
            
                    
                    微服务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="../microservices/微服务详解.html">
            
                <a href="../microservices/微服务详解.html">
            
                    
                    微服务详解
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="../硬件协议/readme.html">
            
                <a href="../硬件协议/readme.html">
            
                    
                    硬件协议
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../硬件协议/modbus/readme.html">
            
                <a href="../硬件协议/modbus/readme.html">
            
                    
                    modbus
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1.1" data-path="../硬件协议/modbus/modbus基本概念.html">
            
                <a href="../硬件协议/modbus/modbus基本概念.html">
            
                    
                    modbus基本概念
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="../redis/readme.html">
            
                <a href="../redis/readme.html">
            
                    
                    redis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../redis/阿里云redis开发规范.html">
            
                <a href="../redis/阿里云redis开发规范.html">
            
                    
                    阿里云redis开发规范
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="../skill/readme.html">
            
                <a href="../skill/readme.html">
            
                    
                    技巧
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="../skill/java问题排查流程.html">
            
                <a href="../skill/java问题排查流程.html">
            
                    
                    java问题排查流程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">架构</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../architecture/readme.html">
            
                <a href="../architecture/readme.html">
            
                    
                    架构介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../architecture/大量设备方案.html">
            
                <a href="../architecture/大量设备方案.html">
            
                    
                    大量设备方案
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">manage</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../manage/readme.html">
            
                <a href="../manage/readme.html">
            
                    
                    管理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../manage/IPD、CMMI、敏捷.html">
            
                <a href="../manage/IPD、CMMI、敏捷.html">
            
                    
                    IPD、CMMI、敏捷
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >第一个docker版的java程序</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><ul><li><span class="title-icon "></span><a href="#&#x57FA;&#x7840;&#x73AF;&#x5883;&#x51C6;&#x5907;"><b></b>&#x57FA;&#x7840;&#x73AF;&#x5883;&#x51C6;&#x5907;</a></li><li><span class="title-icon "></span><a href="#&#x4F8B;&#x5B50;&#xFF1A;mysql"><b></b>&#x4F8B;&#x5B50;&#xFF1A;mysql</a></li><li><span class="title-icon "></span><a href="#&#x4F8B;&#x5B50;&#xFF1A;-redis"><b></b>&#x4F8B;&#x5B50;&#xFF1A; redis</a></li><li><span class="title-icon "></span><a href="#&#x4F8B;&#x5B50;&#xFF1A;influxdb"><b></b>&#x4F8B;&#x5B50;&#xFF1A;influxdb</a></li><li><span class="title-icon "></span><a href="#&#x4F8B;&#x5B50;&#xFF1A;-tomcat"><b></b>&#x4F8B;&#x5B50;&#xFF1A; tomcat</a></li><li><span class="title-icon "></span><a href="#&#x4F8B;&#x5B50;&#xFF1A;jar&#x5F62;&#x5F0F;&#x8FD0;&#x884C;springboot&#x9879;&#x76EE;"><b></b>&#x4F8B;&#x5B50;&#xFF1A;jar&#x5F62;&#x5F0F;&#x8FD0;&#x884C;springboot&#x9879;&#x76EE;</a></li><li><span class="title-icon "></span><a href="#&#x4F8B;&#x5B50;&#xFF1A;nginx"><b></b>&#x4F8B;&#x5B50;&#xFF1A;nginx</a></li></ul></ul></div><a href="#" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><p>&#x4EE5;&#x5E38;&#x89C4;&#x7684;&#x4E00;&#x4E2A;java web&#x9879;&#x76EE;&#x4E3A;&#x4F8B;&#xFF1A;</p>
<p><strong>&#x6570;&#x636E;&#x5E93;&#xFF1A;mysql</strong></p>
<p><strong>&#x7F13;&#x5B58;&#xFF1A;redis</strong></p>
<p><strong>&#x65F6;&#x5E8F;&#x6570;&#x636E;&#x5E93;:influxdb</strong></p>
<p><strong>backend&#x670D;&#x52A1;&#x5668;&#xFF1A;tomcat</strong></p>
<p><strong>frontend&#x670D;&#x52A1;&#x5668;&#xFF1A;nginx</strong></p>
<p><strong>&#x7269;&#x7406;&#x670D;&#x52A1;&#x5668;&#xFF1A;192.168.1.101&#xFF08;&#x5DF2;&#x5B89;&#x88C5;docker&#x73AF;&#x5883;&#xFF09;</strong></p>
<blockquote>
<p>&#x547D;&#x4EE4;&#x8BE6;&#x89E3;&#x53C2;&#x89C1;  <a href="https://www.runoob.com/docker/docker-command-manual.html" target="_blank">https://www.runoob.com/docker/docker-command-manual.html</a></p>
</blockquote>
<hr>
<h2 id="&#x57FA;&#x7840;&#x73AF;&#x5883;&#x51C6;&#x5907;"><a name="&#x57FA;&#x7840;&#x73AF;&#x5883;&#x51C6;&#x5907;" class="anchor-navigation-ex-anchor" href="#&#x57FA;&#x7840;&#x73AF;&#x5883;&#x51C6;&#x5907;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x57FA;&#x7840;&#x73AF;&#x5883;&#x51C6;&#x5907;" class="plugin-anchor" href="#&#x57FA;&#x7840;&#x73AF;&#x5883;&#x51C6;&#x5907;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x57FA;&#x7840;&#x73AF;&#x5883;&#x51C6;&#x5907;</h2>
<pre><code># &#x4E0B;&#x8F7D;docker&#x955C;&#x50CF;&#x5305;
# nginx
docker pull nginx:1.15.2
# mysql
docker pull mysql:5.7.24
# tomcat 
docker pull tomcat:8.5.54-jdk8
# redis
docker pull redis:5.0.9
# influxdb
docker pull influxdb:1.7.9

# &#x521B;&#x5EFA;&#x5DE5;&#x4F5C;&#x76EE;&#x5F55;
mkdir -p /opt/demo/{nginx,mysql,redis,influxdb,tomcat}
</code></pre><h5 id="serverxml&#x3001;redisconf&#x3001;mycnf&#x3001;nginxconf&#x81EA;&#x5907;&#x3002;"><a name="serverxml&#x3001;redisconf&#x3001;mycnf&#x3001;nginxconf&#x81EA;&#x5907;&#x3002;" class="anchor-navigation-ex-anchor" href="#serverxml&#x3001;redisconf&#x3001;mycnf&#x3001;nginxconf&#x81EA;&#x5907;&#x3002;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="serverxml&#x3001;redisconf&#x3001;mycnf&#x3001;nginxconf&#x81EA;&#x5907;&#x3002;" class="plugin-anchor" href="#serverxml&#x3001;redisconf&#x3001;mycnf&#x3001;nginxconf&#x81EA;&#x5907;&#x3002;"><i class="fa fa-link" aria-hidden="true"></i></a>server.xml&#x3001;redis.conf&#x3001;my.cnf&#x3001;nginx.conf&#x81EA;&#x5907;&#x3002;</h5>
<h2 id="&#x4F8B;&#x5B50;&#xFF1A;mysql"><a name="&#x4F8B;&#x5B50;&#xFF1A;mysql" class="anchor-navigation-ex-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;mysql"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x4F8B;&#x5B50;&#xFF1A;mysql" class="plugin-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;mysql"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F8B;&#x5B50;&#xFF1A;mysql</h2>
<pre><code># &#x521B;&#x5EFA;&#x6302;&#x8F7D;&#x76EE;&#x5F55;
mkdir -p /opt/demo/mysql/{conf,data}

# &#x8FD0;&#x884C;mysql&#x6570;&#x636E;&#x5E93;
docker run -idt \
-p 3306:3306 \
-p 33060:33060 \
-v /opt/demo/mysql/conf:/etc/mysql/conf.d \
-v /opt/demo/mysql/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=root \
--name demo-mysql \
mysql:5.7.24


# &#x5B89;&#x88C5;&#x540E;&#xFF0C;&#x5F00;&#x542F;mysql&#x8FDC;&#x7A0B;&#x8BBF;&#x95EE;
docker exec -it demo-mysql /bin/bash

# &#x8FDB;&#x5165;&#x5BB9;&#x5668;&#x540E;&#xFF0C;&#x767B;&#x5F55;mysql
mysql -uroot -p

# &#x767B;&#x5F55;mysql&#x540E;&#xFF0C;&#x6388;&#x6743;
grant all privileges on *.* to root@&quot;%&quot; identified by &quot;root&quot; with grant option; 
flush privileges; 

# &#x9000;&#x51FA;mysql
exit

# &#x8DF3;&#x51FA;&#x5BB9;&#x5668;
ctrl+P,Q

# &#x91CD;&#x542F;mysql&#x5BB9;&#x5668;
docker restart demo-mysql

# &#x4F7F;&#x7528;&#x8FDE;&#x63A5;&#x5DE5;&#x5177;&#xFF08;navicat&#x7B49;&#xFF09;&#x8FDE;&#x63A5;
ip:192.168.1.101 &#x7AEF;&#x53E3;:3306 &#x7528;&#x6237;&#x540D;:root &#x5BC6;&#x7801;:root
</code></pre><h2 id="&#x4F8B;&#x5B50;&#xFF1A;-redis"><a name="&#x4F8B;&#x5B50;&#xFF1A;-redis" class="anchor-navigation-ex-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;-redis"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x4F8B;&#x5B50;&#xFF1A;-redis" class="plugin-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;-redis"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F8B;&#x5B50;&#xFF1A; redis</h2>
<pre><code># &#x521B;&#x5EFA;&#x6302;&#x8F7D;&#x76EE;&#x5F55;
mkdir -p /opt/demo/redis/{conf}

# &#x8FD0;&#x884C;
docker run -idt \
-p 6379:6379 \
-v /opt/demo/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf \
--name demo-redis \
redis:5.0.9 redis-server /usr/local/etc/redis/redis.conf
</code></pre><h2 id="&#x4F8B;&#x5B50;&#xFF1A;influxdb"><a name="&#x4F8B;&#x5B50;&#xFF1A;influxdb" class="anchor-navigation-ex-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;influxdb"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x4F8B;&#x5B50;&#xFF1A;influxdb" class="plugin-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;influxdb"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F8B;&#x5B50;&#xFF1A;influxdb</h2>
<pre><code># &#x521B;&#x5EFA;&#x6302;&#x8F7D;&#x76EE;&#x5F55;
mkdir -p /opt/demo/influxdb/{conf,data,backup}

# &#x751F;&#x6210;&#x9ED8;&#x8BA4;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x3002;
# &#x53EF;&#x53C2;&#x7167;&#x5B98;&#x7F51;&#x914D;&#x7F6E;:https://docs.influxdata.com/influxdb/v1.7/administration/config/

docker run --rm influxdb:1.7.9 influxd config &gt; influxdb.conf

# &#x751F;&#x6210;&#x9ED8;&#x8BA4;&#x914D;&#x7F6E;&#x6587;&#x4EF6;
docker run  --rm \
-p 8088:8088 -p 8086:8086 -p 2003:2003 \
--expose 8090 --expose 8099 \
-e INFLUXDB_GRAPHITE_ENABLED=true \
-e INFLUXDB_ADMIN_USER=root \
-e INFLUXDB_ADMIN_PASSWORD=root \
-v /home/data/influxdb_home/data:/var/lib/influxdb \
influxdb:1.7.9 influxd config &gt; influxdb.conf

# &#x5C06;influxdb.conf&#x62F7;&#x8D1D;&#x5230;/opt/demo/influxdb/conf&#x76EE;&#x5F55;&#x4E0B;

# &#x8FD0;&#x884C;
docker run  -idt \
-p 8088:8088 -p 8086:8086 -p 2003:2003 \
-e INFLUXDB_GRAPHITE_ENABLED=true \
-e INFLUXDB_ADMIN_USER=root \
-e INFLUXDB_ADMIN_PASSWORD=root \
-v /opt/demo/influxdb/data:/var/lib/influxdb \
-v /opt/demo/influxdb/backup:/influxdb_backup \
-v /opt/demo/influxdb/conf/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
--name=influxdb \
influxdb:1.7.9 -config /etc/influxdb/influxdb.conf
</code></pre><h2 id="&#x4F8B;&#x5B50;&#xFF1A;-tomcat"><a name="&#x4F8B;&#x5B50;&#xFF1A;-tomcat" class="anchor-navigation-ex-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;-tomcat"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x4F8B;&#x5B50;&#xFF1A;-tomcat" class="plugin-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;-tomcat"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F8B;&#x5B50;&#xFF1A; tomcat</h2>
<pre><code># &#x521B;&#x5EFA;&#x6302;&#x8F7D;&#x76EE;&#x5F55;
mkdir -p /opt/demo/tomcat/{conf,log,webapps}

# &#x5C06;demo.war&#x5305;&#x62F7;&#x8D1D;&#x5230;/opt/demo/tomcat/webapps&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x5C06;server.xml&#x62F7;&#x8D1D;&#x5230;/opt/demo/tomcat/conf&#x76EE;&#x5F55;&#x4E0B;

# &#x8FD0;&#x884C;
docker run -idt \
-p 8080:8080 \
-v /opt/demo/tomcat/conf/server.xml:/usr/local/tomcat/conf/server.xml  \
-v /opt/demo/tomcat/logs/:/usr/local/tomcat/logs  \
-v /opt/demo/tomcat/webapps/:/usr/local/tomcat/webapps  \
--name demo-tomcat \
tomcat:8.5.54-jdk8-openjdk
</code></pre><h2 id="&#x4F8B;&#x5B50;&#xFF1A;jar&#x5F62;&#x5F0F;&#x8FD0;&#x884C;springboot&#x9879;&#x76EE;"><a name="&#x4F8B;&#x5B50;&#xFF1A;jar&#x5F62;&#x5F0F;&#x8FD0;&#x884C;springboot&#x9879;&#x76EE;" class="anchor-navigation-ex-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;jar&#x5F62;&#x5F0F;&#x8FD0;&#x884C;springboot&#x9879;&#x76EE;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x4F8B;&#x5B50;&#xFF1A;jar&#x5F62;&#x5F0F;&#x8FD0;&#x884C;springboot&#x9879;&#x76EE;" class="plugin-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;jar&#x5F62;&#x5F0F;&#x8FD0;&#x884C;springboot&#x9879;&#x76EE;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F8B;&#x5B50;&#xFF1A;jar&#x5F62;&#x5F0F;&#x8FD0;&#x884C;springboot&#x9879;&#x76EE;</h2>
<pre><code>docker run -idt \
-p 8848:913 \
-v /opt/orororz-train/workspace/Demo/java/app/blackmagic-discovery-euruka1-1.0.0-SNAPSHOT.jar:/usr/local/share/blackmagic-discovery-euruka1-1.0.0-SNAPSHOT.jar \
--name cmh-java \
openjdk:8u201-alpine java -jar /usr/local/share/blackmagic-discovery-euruka1-1.0.0-SNAPSHOT.jar
</code></pre><h2 id="&#x4F8B;&#x5B50;&#xFF1A;nginx"><a name="&#x4F8B;&#x5B50;&#xFF1A;nginx" class="anchor-navigation-ex-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;nginx"><i class="fa fa-link" aria-hidden="true"></i></a><a name="&#x4F8B;&#x5B50;&#xFF1A;nginx" class="plugin-anchor" href="#&#x4F8B;&#x5B50;&#xFF1A;nginx"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4F8B;&#x5B50;&#xFF1A;nginx</h2>
<pre><code># &#x521B;&#x5EFA;&#x6302;&#x8F7D;&#x76EE;&#x5F55;
mkdir -p /opt/demo/nginx/{www,conf,log}

# &#x5C06;&#x7F16;&#x8BD1;&#x597D;&#x7684;&#x524D;&#x7AEF;ui&#x6587;&#x4EF6;&#x653E;&#x5230;/opt/demo/nginx/www&#x76EE;&#x5F55;&#x4E0B;&#x9762;&#xFF0C;nginx.conf&#x653E;&#x5230;/opt/demo/nginx/conf&#x76EE;&#x5F55;&#x4E0B;&#x3002;

# &#x8FD0;&#x884C;
docker run -itd \
-p 80:80 \
--name demo-web \
-v /opt/demo/nginx/www:/usr/share/nginx/html:ro \
-v /opt/demo/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \ #&#x6CA1;&#x6709;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x7684;&#x8BDD;&#xFF0C;&#x5C06;&#x8FD9;&#x53E5;&#x5220;&#x9664;
-v /opt/demo/nginx/log:/var/log/nginx \
nginx:1.15.2

# &#x67E5;&#x770B;&#x8FD0;&#x884C;&#x7ED3;&#x679C;
docker logs -f demo-web

# &#x6D4F;&#x89C8;&#x5668;&#x8BBF;&#x95EE;
http://192.168.1.101/
</code></pre><p><font size="72" color="red">&#x795D;&#x4F60;&#x6210;&#x529F;</font><img src="https://gitee.com/yzry/mypic/raw/master/infotech/20200430162121.gif" alt="ceeb653ely1fkei5cgc4cg208c08c3yt"></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="docker安装.html" class="navigation navigation-prev " aria-label="Previous page: docker安装">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="漫谈云计算、虚拟化、容器化.html" class="navigation navigation-next " aria-label="Next page: 漫谈云计算、虚拟化、容器化">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"第一个docker版的java程序","level":"2.1.3","depth":2,"next":{"title":"漫谈云计算、虚拟化、容器化","level":"2.1.4","depth":2,"path":"容器技术/漫谈云计算、虚拟化、容器化.md","ref":"容器技术/漫谈云计算、虚拟化、容器化.md","articles":[]},"previous":{"title":"docker安装","level":"2.1.2","depth":2,"path":"容器技术/docker安装.md","ref":"容器技术/docker安装.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-back-to-top-button","-lunr","-search","search-pro","chapter-fold","splitter","-expandable-chapters-small","expandable-chapters","anchors","github","-github-buttons","code","anchor-navigation-ex","favicon","advanced-emoji","-sharing","-sharing-plus","-page-copyright","hide-element"],"styles":{"website":"./styles/website.css"},"pluginsConfig":{"chapter-fold":{},"github":{"url":"https://github.com/nullllun"},"splitter":{},"search-pro":{},"page-copyright":{"wisdom":"technology and management，software and hardware","noPowered":false,"copyright":"Copyright &#169; 字维嘉","style":"normal","timeColor":"#666","utcOffset":"8","format":"YYYY-MM-dd hh:mm:ss","signature":"yzry","copyrightColor":"#666","description":"modified at"},"code":{"copyButtons":true},"donate":{"alipay":"./source/images/donate.png","title":"","button":"赞赏","alipayText":" "},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":false},"favicon":{"shortcut":"./source/images/favicon.jpg","bookmark":"./source/images/favicon.jpg","appleTouch":"./source/images/apple-touch-icon.jpg","appleTouchMore":{"120x120":"./source/images/apple-touch-icon.jpg","180x180":"./source/images/apple-touch-icon.jpg"}},"github-buttons":{"buttons":[{"user":"nullllun","repo":"glory","type":"star","size":"small","count":true}]},"advanced-emoji":{"embedEmojis":false},"sharing":{"qq":false,"all":["google","facebook","weibo","twitter","qq","qzone","linkedin","pocket"],"douban":false,"facebook":false,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"expandable-chapters":{}},"theme":"default","author":"字维嘉","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"猿者荣耀","language":"zh-hans","links":{"sidebar":{"字维嘉":"http://orororz.com"}},"gitbook":"3.2.3","description":"金鳞岂是池中物"},"file":{"path":"容器技术/第一个docker版的java程序.md","mtime":"2020-05-12T09:14:06.524Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-05-21T09:00:35.532Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

